package com.ship.control.impl;


import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;

import com.ship.control.AbstractAdminCommandController;
import com.ship.control.search.SearchStat;
import com.ship.control.search.ShipMaterialSearchCond;
import com.ship.entity.ShipMaterial;
import com.ship.service.ShipService;


/**
 * 物料清单查询
 * @author wqf
 * Nov 27, 2011 3:36:30 PM
 */
public class ShowMaterialListController extends AbstractAdminCommandController {

	public ShowMaterialListController(){
		this.setCommandClass(ShipMaterialSearchCond.class);
	}
	
	
	protected ModelAndView executeRequest(HttpServletRequest request,HttpServletResponse response,Object command)
		throws Exception{
		
		ShipMaterialSearchCond shipMaterialSearchCond=(ShipMaterialSearchCond)command;
		ModelAndView mav=new ModelAndView(this.view);
		shipMaterialSearchCond.setPageSize(10L);
		SearchStat searchStat=this.shipService.getSearchStat(ShipMaterial.class, shipMaterialSearchCond);
		List<ShipMaterial> supplierList=this.shipService.getShipMaterialList(shipMaterialSearchCond);
		mav.addObject("searchStat", searchStat);
		mav.addObject("shipMaterialList", supplierList);
		mav.addObject("shipMaterialSearchCond", shipMaterialSearchCond);
		return mav;		
	}
		
	private String view;
	private ShipService shipService;

	public void setShipService(ShipService shipService) {
		this.shipService = shipService;
	}

	public void setView(String view) {
		this.view = view;
	}
	
}
